<?php
require_once("../../resources/commons.php");
require_once("../../data/User.php");
require_once("../../data/Report.php");
require_once("HTTP.php");

SessionManager::getInstance()->checkSession();

$l_reportId=base64_decode($_REQUEST["id"]);
if(isset($l_reportId)){
	$l_report=Report::getFromPrimaryKey($l_reportId);
	$l_userManagerId=$l_report->getUser_Id_Ref()->getManagerUser_Id();
	if(isset($l_report) && ($l_userManagerId==SessionManager::getCurrentLoggedUserId()|| !isset($l_userManagerId))){
		$l_report->setValidated(true);
		$l_report->save();
	}
}

HTTP::redirect("team_overview.php");
?>